Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Question Cognito AWS authentication in Unity WebGL

Discussion in 'Web' started by LoopIssuer, Feb 4, 2023.

  1. LoopIssuer

    LoopIssuer

    Joined:
    Jan 27, 2020
    Posts:
    109
    Hi,
    Please tell me - how to make Unity build in WebGL working with Cognito services. As far as I know, there is no SDK for WebGL.
    So how can I implement Cognito functionalities like Login, Refresh Token, Forgot password in Unity WebGL
     
  2. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    6,422
  3. LoopIssuer

    LoopIssuer

    Joined:
    Jan 27, 2020
    Posts:
    109
    Yes, but this applies to AWS .Net SDK, right?
    My question is - can I use i.e. Cognito API with HTTP requests directly in Unity?
    Or do sth else, but still using Cognito?
     
  4. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    6,422
    If there is a HTTP request api you can use any such service from WebGL using the WebRequest class.
     
  5. FarmerInATechStack

    FarmerInATechStack

    Joined:
    Dec 28, 2020
    Posts:
    57
    @LoopIssuer I might be investigating something similar (but not for WebGL specifically). Are you still working on this too?

    Instead of building my implementation with the SDK, I'm working on a proxy integration using the AWS services and REST endpoints. Alexandre Bruffa seems to have a few tutorials that cover that approach too: https://betterprogramming.pub/how-i-built-a-hotel-platform-with-unity3d-and-aws-22bd3c315d81

    I also plan to check the AWS documentation: https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-rest-tutorials.html
     
  6. LoopIssuer

    LoopIssuer

    Joined:
    Jan 27, 2020
    Posts:
    109
    Yes, I ended with BE's endpoints - on the BE we have Cognito SDK.
     
  7. manuelgoellnitz

    manuelgoellnitz

    Joined:
    Feb 15, 2017
    Posts:
    398
    The AWS .net libraries don't work in WebGL.
    I used the ones for javascript and let the browser do the communication.
     
  8. LoopIssuer

    LoopIssuer

    Joined:
    Jan 27, 2020
    Posts:
    109
    @manuelgoellnitz
    Could you please explain more about how to use javascript SDK in Unity?
     
  9. FarmerInATechStack

    FarmerInATechStack

    Joined:
    Dec 28, 2020
    Posts:
    57
    I'm not sure what you mean by "BE's endpoints."

    Also, to clarify, I do not mean using SDKs.
     
  10. manuelgoellnitz

    manuelgoellnitz

    Joined:
    Feb 15, 2017
    Posts:
    398
    You can call Javascript via Unity and vice versa.
    Now get the aws javascript libraries and implement the login like on a website.
    Then just call them from unity.