Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by kimv · Jul 12, 2018 at 09:10 AM · authentication

How to use AWS AppSync in Unity

I am trying to use AppSync from AWS (https://aws.amazon.com/appsync/) in Unity.

I created a new app with the sample source data (see image below) and I am trying to simply access the data, without any success so far. The Auth Mode for the app is set to API KEY. alt text

In order to add the AppSync library to Unity, I used the extension "NuGet for Unity" from ReCreation Studios, which works perfectly with other AWS libraries like Cognito.

This is my script:

 void Start () {
     InitAmazonAppSyncClient();
     DoMagicWithAppSync();
 }

 private void DoMagicWithAppSync()
 {
     var request = new GetDataSourceRequest();

     request.ApiId = apiId;
     request.Name = "AppSyncEventTable";
     amazonAppSyncClient.GetDataSource(request);
 }

 private void InitAmazonAppSyncClient()
 { 
     AmazonAppSyncConfig config = CreateAmazonAppSyncConfig();
     // TODO how do I set the apiKey and the url????
     amazonAppSyncClient = new AmazonAppSyncClient(config);
     Debug.Log("client instantiated");
 }

 private AmazonAppSyncConfig CreateAmazonAppSyncConfig()
 {
     AmazonAppSyncConfig config = new AmazonAppSyncConfig
     {
         LogResponse = true,
         RegionEndpoint = Amazon.RegionEndpoint.EUWest1
     };
     config.Validate();
     Debug.Log("Config validated");
     return config;
 }


This results in the following exception: AmazonServiceException: Failed to retrieve credentials from EC2 Instance Metadata Service.

I can't seem to find a way to set the apiKey or apiUrl anywhere and their documentation does not seem to help at all. In their android sample project, there's a way to set the apiKey and apiUrl when instantiating the client (https://github.com/aws-samples/aws-mobile-appsync-events-starter-android/blob/master/app/src/main/java/com/amazonaws/demo/appsync/ClientFactory.java), but I did not find a way to do this in Unity. Neither the AmazonAppSyncConfig nor the AmazonAppSyncClient have any fields related to apiKey or apiUrl.

I did find a serviceUrl in the config, but when I change that, I get a 500 Internal Server Error.

There is a class called AWSCredentials, which can be passed in the constructor of the AmazonAppSyncClient, but again, I can't find a way to set anything in the AWSCredentials class.

Any ideas?

data-sources.png (12.6 kB)
Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image aahinoam · Aug 23, 2019 at 07:46 AM 0
Share

Hi @kimv, did you find a solution?

avatar image JamesSozoLabs · Nov 17, 2021 at 10:27 PM 0
Share

Would also like to know if you ever got this working.

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

87 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Caching AssetBundle downloaded previously without using WWW.LoadFromCacheOrDownload 0 Answers

Accessing X509Store returns zero certificates 0 Answers

Twitter SDK for Unity: Bad Authentication Data, error code 215 2 Answers

I can not get oAuth working on Android App made with Unity3D 0 Answers

Help with Game Center login. 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges