Coder Social home page Coder Social logo

unity3d.authentication.example's People

Contributors

darioskrimskrams avatar florianauer avatar guneyozsan avatar peterhorsley avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

unity3d.authentication.example's Issues

Suggestion: Add documentation around requiring a GameObject named SignInCanvas

First off, thanks for this example implementation. It has been extremely helpful in getting up and running with OAuth through IdentityServer in Unity.

Currently, the Unity Implementation expects a GameObject named "SignInCanvas" to have a script with an "OnAuthReply(string)" method to receive the response from the platform specific web view. I have not found this documented anywhere in this repo.

My suggestion is to add a line to the README documenting this. Additionally, a config option to change this name would be useful.

Thanks again for this extremely useful example!

Canvas name hardcoded in AndroidProject

The Canvas name is hardcoded in the AndroidProject: To use the Activity behind the plugin with your own project (your own scenes/canvas), you need to rename your Canvas to the same name used in demo project. Better solution would be to changed it in AndroidProject but then you have to re-build the AndroidUnityPlugin.jar file.

  • At least a info in the documentation is needed.
  • A better solution for this problem would be nice.
  • I don't actually know if there is a problem when using this with multiple canvas,, but I could expect this doesn't work at the moment :/

Edit: Realized there is already a issue for that: #1

Does this work with Google SSO

We have the package working successfully with our endpoint, but when we try to use google single sign on it seems to create an error.

Is this intended to work?

Thanks
Ben

mcs.rsp file is missing

Could you please indicate where I can find the missing file? On ReadMe file there is the instruction to put it under assets folder, but I cannot find the respective file.

Won't compile Unity 2018.3.11 iOS min 13.0 XCode 12.5 MacOS BigSur

Hello there !

The project freshly opened won't compile with error as shown below.

I also tried adding Link Binary with libraries AuthenticationServices.framework and SafariServices.framework both to optional but same error shows. Guidance appreciated please !

Ld /Users/myusername/Library/Developer/Xcode/DerivedData/Unity-iPhone-hiikkwzqdiflfbhzlnylgols/Build/Products/Debug-iphoneos/appname.app/appname normal (in target 'Unity-iPhone' from project 'Unity-iPhone')
cd /Users/myusername/Documents/Work/AppAuth/DevBuild/AppAuthapp
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -target arm64-apple-ios13.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.5.sdk -L/Users/myusername/Library/Developer/Xcode/DerivedData/Unity-iPhone-hiikkwzqdiflfbhzlnylgols/Build/Products/Debug-iphoneos -L/Users/myusername/Documents/Work/AppAuth/DevBuild/AppAuthapp -L/Users/myusername/Documents/Work/AppAuth/DevBuild/AppAuthapp/Libraries -F/Users/myusername/Library/Developer/Xcode/DerivedData/Unity-iPhone-hiikkwzqdiflfbhehiwzlnylgols/Build/Products/Debug-iphoneos -filelist /Users/myusername/Library/Developer/Xcode/DerivedData/Unity-iPhone-hiikkwzqdiflfbhehiwzlnylgols/Build/Intermediates.noindex/Unity-iPhone.build/Debug-iphoneos/Unity-iPhone.build/Objects-normal/arm64/appname.LinkFileList -Xlinker -map -Xlinker /Users/myusername/Library/Developer/Xcode/DerivedData/Unity-iPhone-hiikkwzqdiflfbhehiwzlnylgols/Build/Intermediates.noindex/Unity-iPhone.build/Debug-iphoneos/Unity-iPhone.build/appname-LinkMap-normal-arm64.txt -dead_strip -Xlinker -object_path_lto -Xlinker /Users/myusername/Library/Developer/Xcode/DerivedData/Unity-iPhone-hiikkwzqdiflfbhehiwzlnylgols/Build/Intermediates.noindex/Unity-iPhone.build/Debug-iphoneos/Unity-iPhone.build/Objects-normal/arm64/appname_lto.o -Xlinker -no_deduplicate -fembed-bitcode-marker -stdlib=libc++ -fobjc-arc -fobjc-link-runtime -weak_framework CoreMotion -weak-lSystem -framework Security -framework MediaToolbox -liPhone-lib -framework CoreText -framework AudioToolbox -weak_framework AVFoundation -framework AVKit -framework CFNetwork -framework CoreGraphics -framework CoreMedia -weak_framework CoreMotion -framework CoreVideo -framework Foundation -framework OpenAL -framework OpenGLES -framework QuartzCore -framework SystemConfiguration -framework UIKit -liconv.2 -lil2cpp -weak_framework Metal -Xlinker -no_adhoc_codesign -Xlinker -dependency_info -Xlinker /Users/myusername/Library/Developer/Xcode/DerivedData/Unity-iPhone-hiikkwzqdiflfbhehiwzlnylgols/Build/Intermediates.noindex/Unity-iPhone.build/Debug-iphoneos/Unity-iPhone.build/Objects-normal/arm64/appname_dependency_info.dat -o /Users/myusername/Library/Developer/Xcode/DerivedData/Unity-iPhone-hiikkwzqdiflfbhehiwzlnylgols/Build/Products/Debug-iphoneos/appname.app/appname

Undefined symbols for architecture arm64:
"OBJC_CLASS$_SFSafariViewController", referenced from:
objc-class-ref in SafariView.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

How to refresh a token

Can you explain how refresh tokens work?
If a token is due to expire, how do you request a new refresh token?

iOS: Logout not working

When I click logout, the button changes to PLEASE WAIT and does not go any further.

Running on commit 7f8b388, cause that's the latest one working on iOS properly. Unity 2018.2.21f. iOS 12.1.4

Here are the logs:

SignInBehavior::Start
SignInBehavior::Signing in...
UnityAuthLogger: Trace, , LoginAsync
UnityAuthLogger: Information, , Starting authentication request.
UnityAuthLogger: Trace, , EnsureProviderInformation
MonoRemoteCertificateValidationCallback
UnityAuthLogger: Debug, , Successfully loaded discovery document
UnityAuthLogger: Debug, , Loaded keyset from https://demo.identityserver.io/.well-known/openid-configuration/jwks
UnityAuthLogger: Debug, , Keyet contains the following kids: baa666f56ffcee251e4cc6e43c246ef0
UnityAuthLogger: Trace, , Effective options:
UnityAuthLogger: Trace, , Logging has been disabled
UnityAuthLogger: Trace, , AuthorizeAsync
UnityAuthLogger: Trace, , CreateAuthorizeStateAsync
UnityAuthLogger: Trace, , CreatePkceData
UnityAuthLogger: Trace, , CreateNonce
UnityAuthLogger: Trace, , CreateState
UnityAuthLogger: Trace, , CreateAuthorizeUrl
UnityAuthLogger: Trace, , CreateAuthorizeParameters
UnityAuthLogger: Trace, , ObjectToDictionary
UnityAuthLogger: Debug, , Logging has been disabled
2019-04-30 12:45:21.283920+0200 unityclient[555:124025] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /private/var/containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
2019-04-30 12:45:21.284170+0200 unityclient[555:124025] [MC] Reading from public effective user settings.
2019-04-30 12:45:24.755472+0200 unityclient[555:124025] [Common] _BSMachError: port 11613; (os/kern) invalid capability (0x14) "Unable to insert COPY_SEND"
2019-04-30 12:45:32.076053+0200 unityclient[555:124025] url received io.identitymodel.native://callback?code=5c19d9e293b0a6f07a1dbd6ae854869e6b63c76c6f2990cb0ec2924514a17e5b&scope=openid%20profile%20email&state=d1f4e44bfa51c0d4e5f69b7c6a89d8ea&session_state=4OZ1W1V7P6sWAmO0607DsQJsCN8g-VvJg9Tny5JuhfI.bb0de00a5c30b6f1edbfa0fc24f70d89
2019-04-30 12:45:32.076242+0200 unityclient[555:124025] received auth reply with query string
SignInBehavior::OnAuthReply: code=5c19d9e293b0a6f07a1dbd6ae854869e6b63c76c6f2990cb0ec2924514a17e5b&scope=openid%20profile%20email&state=d1f4e44bfa51c0d4e5f69b7c6a89d8ea&session_state=4OZ1W1V7P6sWAmO0607DsQJsCN8g-VvJg9Tny5JuhfI.bb0de00a5c30b6f1edbfa0fc24f70d89
MobileBrowser.OnAuthReply: code=5c19d9e293b0a6f07a1dbd6ae854869e6b63c76c6f2990cb0ec2924514a17e5b&scope=openid%20profile%20email&state=d1f4e44bfa51c0d4e5f69b7c6a89d8ea&session_state=4OZ1W1V7P6sWAmO0607DsQJsCN8g-VvJg9Tny5JuhfI.bb0de00a5c30b6f1edbfa0fc24f70d89
UnityAuthLogger: Trace, , ProcessResponseAsync
UnityAuthLogger: Information, , Processing response.
UnityAuthLogger: Trace, , EnsureProviderInformation
UnityAuthLogger: Debug, , Successfully loaded discovery document
UnityAuthLogger: Debug, , Loaded keyset from https://demo.identityserver.io/.well-known/openid-configuration/jwks
UnityAuthLogger: Debug, , Keyet contains the following kids: baa666f56ffcee251e4cc6e43c246ef0
UnityAuthLogger: Trace, , Effective options:
UnityAuthLogger: Trace, , Logging has been disabled
UnityAuthLogger: Debug, , Authorize response: code=5c19d9e293b0a6f07a1dbd6ae854869e6b63c76c6f2990cb0ec2924514a17e5b&scope=openid%20profile%20email&state=d1f4e44bfa51c0d4e5f69b7c6a89d8ea&session_state=4OZ1W1V7P6sWAmO0607DsQJsCN8g-VvJg9Tny5JuhfI.bb0de00a5c30b6f1edbfa0fc24f70d89
UnityAuthLogger: Trace, , ProcessResponseAsync
UnityAuthLogger: Trace, , ProcessCodeFlowResponseAsync
UnityAuthLogger: Trace, , RedeemCodeAsync
UnityAuthLogger: Trace, , ValidateTokenResponse
UnityAuthLogger: Trace, , Validate
UnityAuthLogger: Debug, , Added signing key with kid: baa666f56ffcee251e4cc6e43c246ef0
UnityAuthLogger: Trace, , ValidateNonce
UnityAuthLogger: Trace, , ValidateHash
UnityAuthLogger: Trace, , GetMatchingHashAlgorithm
UnityAuthLogger: Debug, , Determining matching hash algorithm for RS256
UnityAuthLogger: Debug, , SHA256
UnityAuthLogger: Trace, , GetUserInfoAsync
UnityAuthLogger: Trace, , EnsureProviderInformation
UnityAuthLogger: Debug, , Successfully loaded discovery document
UnityAuthLogger: Debug, , Loaded keyset from https://demo.identityserver.io/.well-known/openid-configuration/jwks
UnityAuthLogger: Debug, , Keyet contains the following kids: baa666f56ffcee251e4cc6e43c246ef0
UnityAuthLogger: Trace, , Effective options:
UnityAuthLogger: Trace, , Logging has been disabled
UnityAuthLogger: Trace, , ProcessClaims
UnityAuthLogger: Information, , Authentication request success.
UnityAuthClient::Dismissing sign-in browser.
UnityAuthClient::AccessToken: eyJhbGciOiJSUzI1NiIsImtpZCI6ImJhYTY2NmY1NmZ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NoIjoiNlVjUEdQT0s1OXc2eHktTmk1SWhpdyIsInNpZCI6IjAzOTQ0YmQ2YjJlNDljY2ZmNWQyZDA2NmM0NjA1NGFiIiwic3ViIjoiMTEiLCJhdXRoX3RpbWUiOjE1NTY2MjExMzEsImlkcCI6ImxvY2FsIiwiYW1yIjpbInB3ZCJdfQ.IYTsgAUJ_HGk1A5j8g-5YqVPLUKVmhLE8ziW65bM25pNhDfdih_6Rvgi83ka29VHnVvguKzh2M-PhNGQq_H94L7XMf5flsmSoyXCGBUWI4n55_Mge8PQmpxZNPLCAhP13L9rawbiqqS30FMw-euEgKT_f0Iolt7zlcwiphOj6VxDsVNwofCO47J8briKD4UsZb8VX5V7yWvfcmJUUR_Y6HKLNMBwYKIn-IBunPhofKwm-QEi8CcAPh7CtopqRYckHYifNl_DkBlIfWWSsxTVgF6bzqYJ5wkjf95gJIjryUizTYJ2v5_0uL8QJJnuJ9gP_CAb15rKa4r9K9wvYduPSg
UnityAuthClient::Signed in.
SignInBehavior::Signing out...
UnityAuthLogger: Trace, , EnsureProviderInformation
UnityAuthLogger: Debug, , Successfully loaded discovery document
UnityAuthLogger: Debug, , Loaded keyset from https://demo.identityserver.io/.well-known/openid-configuration/jwks
UnityAuthLogger: Debug, , Keyet contains the following kids: baa666f56ffcee251e4cc6e43c246ef0
UnityAuthLogger: Trace, , Effective options:
UnityAuthLogger: Trace, , Logging has been disabled
UnityAuthLogger: Trace, , CreateEndSessionUrl

Re-compile IdentityModel Protection Level

Following the steps provided:
"Unity does not support nuget nicely, so you must clone and compile IdentityModel.OidcClient2 solution using Visual Studio 2017.
Copy the release binaries from IdentityModel.OidcClient/bin/release/net452 to a folder in your Unity project's Assets folder.
Delete System.Runtime.InteropServices.RuntimeInformation.dll as this DLL is not compatible with Unity."

I needed to change the "code id_token" strings to "code" and attempted a recompile. Dragging in the new binaries to Unity I have compile error for LogSerializer

"Assets/UnityAuthClient.cs(23,13): error CS0122: `IdentityModel.OidcClient.Infrastructure.LogSerializer' is inaccessible due to its protection level"

Please advise

Documentation not complete for iOS

Hey everyone, after trying to get this to work for the past day or so on iOS with the app I am working on I found some things that didn't make it into the documentation to make iOS work with different Redirect URI's that the example provided.

First off, in the 'iOS support' section, you guys mention the file 'OAuthUnityAppController.mm'. There is no such file, but instead its just 'AuthUnityAppController.mm'. This confused me at first and may need to be changed for future users (documentation or file name).

Secondly, once you change the RedirectUri in the OidcClientOptions you need to change it in that 'AuthUnityAppController.mm' to match (without the "://callback" appended). But that isn't the only place you need to change. In 'BuildPostProcess.cs' you will have to change the registering url schemes to match your app's info. Including the app's bundle identifier and URL scheme (the redirect uri). Changing those made it finally work for me!

Thanks for the great plugin guys!

AuthUnityAppController is misreferenced in README

README says

Derive an objective-c class from UnityAppController to handle auth redirects (see OAuthUnityAppController.mm).

But the class is actually called AuthUnityAppController.mm. It might seem small, but I was looking in the ios plugins folder for a file called OAuthUnityAppController.mm and when I couldn't find one my first assumption was that it had somehow gone missing or the documentation was just wrong.

iOS login not working

Hey Peter, highly appreciate the work you have done. Concerning iOS, you developed the only sample I could find. We'd like to use the authentication in an productive environment. I tried to find the bug myself but with no luck. Would highly appreciate it, if you could give me a clue what I'm doing wrong. I added a recording.

Steps before:

  • Clone Project
  • Wire up unity button and text
  • under 'Rarely used services' select 'SafariServices'.
  • run on android - working!
  • delete browser data on iOS

what you may not see: I clicked on "Login", the uri changed very briefly. After that I waited for 1 or 2 seconds and tried "Login" once more. After that the browser shows no content any more.

Unity 2018.3.1 and 2018.3.3
iOS 12.1
XCode 10.1

The sample https://github.com/IdentityModel/IdentityModel.OidcClient.Samples/tree/master/iOS11Client is working correctly

Note: There is no system-dialog popup for thirdparty service concerning login like in normal iOS sample

ScreenRecording_01-28-2019 10-49-22.m4v.zip

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.