2016-08-04 48 views
2

我一直在按照步骤设置示例Ruby应用程序,登录时https://dev.office.com/Getting-Started/office365Apis?platform=option-ruby,当我运行该应用程序并单击登录按钮时,出现一个错误的Uri错误bad argument (expected URI object or URI string),它指示我omn​​iauth-azure-activedirectory gem中的第105行。 (文件azure_activedirectory.rb)Office 365 API Ruby示例应用程序已损坏

# Constructs a one-time-use authorize_endpoint. This method will use 
    # a new nonce on each invocation. 
    # 
    # @return String 
    def authorize_endpoint_url 
    uri = URI(openid_config['authorization_endpoint']) 
    uri.query = URI.encode_www_form(client_id: client_id, 
            redirect_uri: callback_url, 
            response_mode: response_mode, 
            response_type: response_type, 
            nonce: new_nonce) 
    uri.to_s 
    end 

经过进一步调查,我得到一个无效的承租人错误。 Pry显示:pry image 奇怪的是,如果我在相同租户下运行node.js和angular示例应用程序,它可以正常运行,没有问题。似乎与Gem和它查询Microsoft Graph API的方式有一些脱节...

回答

2

在那时,gem只是试图将您重定向到授权URL。我想这是你的域名moser-inc.onmicrosoft.com有问题。

这与出现在/config/environment.rb文件中的域是否相同?

我想知道图书馆是否有连字符问题。

只是为了确认,你从来没有机会输入凭据,对吧? 你可以尝试从隐身窗口?

+1

是的,它与environment.rb文件中的相同,该文件是从站点自动生成的。幸运的是,我发现这个网站https://dev.office.com/code-samples-detail/2142提供了一个演练,没有使用omniauth-azure gem。我只是在寻找一些可以解决的问题,所以问题得到了解决。 https://dev.office.com/code-samples-detail/2142 –

+1

和我同意,我认为'-'是问题的一部分 –