-
-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unauthorized error for getting session #166
Comments
@gen1us2k could you maybe take a look at this? It looks like some config value is set incorrectly, as it uses the playground instead of the user‘s URL? |
@yunsun330 the SDK does not support env vars, make sure you pass your SDK URL to the python SDK configuration:) |
@aeneasr I am integrating ory on Ruby on Rails |
I believe @gen1us2k found how to fix it on Slack? |
Yep. I recommended a workaround by calling |
Thanks for your reply |
@gen1us2k is there an issue for the Ruby client? If yes, can you please link it for some context? |
require 'time'
require 'ory-client'
# setup authorization
OryClient.configure do |config|
# Configure Bearer authorization: oryAccessToken
config.scheme = "https"
config.host = "auth.gen1us2k.com"
config.base_path=""
config.debugging = true
end
api_instance = OryClient::V0alpha2Api.new
begin
# Create an Identity
cookie = "ory_session_lovingturinguo2cv9nlhi=MTY0OTA2ODI2MHwwNmY1d1NzbnhFYnNMLWN6V1ZrTExGekFZaElKWC1MazBHSlBkNFJNM3VicTZ5d0oyZEx6QTZtajUwQ01EZ2Y5Ri1hRzV4ZnRpb095OUlHeDYtRUdFMEtvYXNMYUtvNjdZMnYwdWJBOEpmRjhkTE1SbUoxTGpGMDhCWnBrelZPM2JnZzd3NGlUYnc9PXxdHkHsMemULre3MmmARWH0O6WSxHsCdnFK_TWtmDaJUg=="
opts = {cookie:cookie}
p api_instance
result = api_instance.to_session(opts)
p result
p result
rescue OryClient::ApiError => e
puts "Error when calling V0alpha2Api->admin_create_identity: #{e}"
end Here's an example of how to reproduce the issue. Ory Ruby SDK always uses playground URL, and it's impossible to configure a host |
+1. I am facing the same issue it is always uses playground URL even after configuration. |
Preflight checklist
Describe the bug
Hello. I have integrated Ory Cloud in Rails project with ory-client
I made proxy with ory cli and worked login and registration successfully
I created project and got SDK configuration on ORY console.
And set env variable ORY_SDK_URL with that on my local.
I am trying to check session via api_instance.to_session, but gets unauthorized error
This endpoint calls https://playground.projects.oryapis.com/ all the time.
Would you help me how to create instance for my project which I created on ory console?
I set configuration like this:
And
But got error
HTTP status code: 401
Response headers: {"Date"=>"Fri, 01 Apr 2022 09:54:29 GMT", "Content-Type"=>"application/json", "Content-Length"=>"186", "Connection"=>"keep-alive", "cache-control"=>"private, no-cache, no-store, must-revalidate", "vary"=>"Origin,Cookie", "CF-Cache-Status"=>"DYNAMIC", "Expect-CT"=>"max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\"", "Set-Cookie"=>"__cflb=0pg1RbZMZcQY6KwtZw8ZHrqdVBkfNrHJsczBvGfV; SameSite=None; Secure; path=/; expires=Fri, 01-Apr-22 10:54:29 GMT; HttpOnly", "Server"=>"cloudflare", "CF-RAY"=>"6f507192aa59f55d-SEA", "alt-svc"=>"h3=":443"; ma=86400, h3-29=":443"; ma=86400"}
Response body: {"error":{"code":401,"status":"Unauthorized","request":"9fd4c275-2ca9-98ca-b1a7-a205a5175aa9","reason":"No valid session cookie found.","message":"The request could not be authorized"}}
ETHON: performed EASY effective_url=https://playground.projects.oryapis.com/sessions/whoami response_code=401 return_code=ok total_time=0.75955
Error when calling V0alpha2Api->to_session_with_http_info: Error message: the server returns an error
Reproducing the bug
You can check on this link:
https://ory-community.slack.com/archives/C02MR4DEEGH/p1648814785876499
Relevant log output
No response
Relevant configuration
No response
Version
Ruby 2.6.5, Rails 5.6.5
On which operating system are you observing this issue?
No response
In which environment are you deploying?
No response
Additional Context
No response
The text was updated successfully, but these errors were encountered: